import { _decorator, Component, Node } from 'cc';
import { BaseView } from '../../../../scripts/libs/rxjs/cc3/BaseView';
import { Button } from 'cc';
import { BindButton } from '../../../../scripts/libs/rxjs/cc3/BindButton';
import { gm } from '../../../../scripts/managers/GameManager';
import { Prefab } from 'cc';
import { shapeInfoMap } from '../../game/basic';
import { instantiate } from 'cc';
import { ShapeEditorButton } from './ShapeEditorButton';
const { ccclass, property } = _decorator;

@ccclass('EditorTools4')
export class EditorTools4 extends BaseView {

    @property(Prefab)
    shapeEditorButtonPrefab: Prefab = null;

    @property(Node)
    shapeContentNode: Node = null;

    willBind(): void {
        this.shapeContentNode.destroyAllChildren();
        for (let [shapeId, shapeInfo] of shapeInfoMap) {
            if (shapeId == 0) continue;
            let shapeEditorButton = instantiate(this.shapeEditorButtonPrefab).getComponent(ShapeEditorButton);
            shapeEditorButton.shapeId = shapeId;
            shapeEditorButton.colorId = Number(1);
            this.shapeContentNode.addChild(shapeEditorButton.node);
        }
    }

}

